<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:o="http://openfaces.org/"
	template="/WEB-INF/esquema/plantillaworkflow.xhtml">

	<!--
	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/esquema/sidebar2.xhtml"/>
	</ui:define>
	-->
	<ui:define name="mainControls">
		<h:form>
			<h:outputText value="#{messages['analysis.dictum']}" />
			<h:outputText value="     " />
			<a4j:commandButton value="#{messages['analysis.btn.request_proceeds']}" oncomplete="#{rich:component('strict-confirmation-dialog')}.show()">
				<f:setPropertyActionListener target="#{dialogHelper.confirmMsg}" value="#{messages['analysis.finish_proceed']}"/>
				<f:setPropertyActionListener target="#{dialogHelper.jsFunction}" value="endAnalysisOK();"/>
			</a4j:commandButton>
			<a4j:commandButton value="#{messages['analysis.btn.request_notproceeds']}" oncomplete="#{rich:component('strict-confirmation-dialog')}.show()">
				<f:setPropertyActionListener target="#{dialogHelper.confirmMsg}" value="#{messages['analysis.finish_doesnot_proceed']}"/>
				<f:setPropertyActionListener target="#{dialogHelper.jsFunction}" value="endAnalysisDenied();"/>
			</a4j:commandButton>
		</h:form>
	</ui:define>

	<ui:define name="extraControls">
		<h:form>
			<a4j:commandButton value="#{messages['button.l8r']}" oncomplete="#{rich:component('confirmation-dialog')}.show()">
				<f:setPropertyActionListener target="#{dialogHelper.confirmMsg}" value="#{messages['analysis.l8r']}"/>
				<f:setPropertyActionListener target="#{dialogHelper.jsFunction}" value="pause();"/>
			</a4j:commandButton>
		</h:form>
	</ui:define>
	
	<ui:define name="body">
		<div align="center">
			<br/>
			<strong>#{messages['analysis.header']}</strong>
			<rich:separator lineType="solid"/>
			<br/>

			<ui:include src="/WEB-INF/includes/showHelpIncl.xhtml">
				<ui:param name="width" value="500" />
				
				<ui:param name="msgBullet"  value="#{messages['analysis.bullet1']}" />
				<ui:param name="msgBullet1" value="#{messages['analysis.bullet2']}" />
			</ui:include>

			<br/>
		</div>
		<h:form>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.type']}</strong>
				<rich:separator lineType="solid"/>
				<h:panelGrid columns="2">
					<h:outputText value="#{messages['analysis.request_type']}" />
					<h:selectOneMenu value="#{transactionHelper.requestType}" converter="#{uiConverters.municipalTransactionType}">
						<f:selectItems value="#{uiConverters.municipalTransactionType.valueList}"/>
					</h:selectOneMenu>
				</h:panelGrid>
			</div>
			<br/>
			<br/>
			<div align="center">
				<strong>#{messages['analysis.property_list']}</strong>
				<rich:separator lineType="solid"/>
				<br />
				<a4j:commandLink ajaxSingle="true" oncomplete="#{rich:component('selectZonePanel')}.show()">
					<h:outputText value="#{messages['permit.select_zone']}"/>
				</a4j:commandLink>
				<br />
				<br />
				<br />
				<h:panelGroup id="grpZone">
					<ui:repeat value="#{transactionHelper.requestedZoneList}" var="zone">
						<rich:panel>
							<table style="width:90%">
								<tr>
									<td>
										<rich:panel>
										<ui:include src="/WEB-INF/includes/zoneInfoIncl.xhtml">
											<ui:param name="zone" value="#{zone}" />
											<ui:param name="noZoneMsg" value="#{messages['permit.no_zone_selected']}" />
											<ui:param name="width" value="50%" />
										</ui:include>
										</rich:panel>
									</td>
									<td valign="top">
										<rich:panel>
										<a4j:commandButton
											value="#{messages['button.delete']}"
											action="#{transactionHelper.excludeSelectedZone(zone)}"
											reRender="grpZone"
											immediate="true">
										</a4j:commandButton>
										</rich:panel>
									</td>
								</tr>
							</table>
						</rich:panel>
					</ui:repeat>
				</h:panelGroup>
			</div>

			<br/>
			<br/>
			
			<div align="center">
				<br/>
				<strong>#{messages['analysis.dictum']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<h:inputTextarea value="#{transactionHelper.transaction.analysisDictum}" rows="5" style="width:75%">
				</h:inputTextarea>
			</div>
				
			<br/>
			<br/>
			<div align="center">
				<br/>
				<strong>#{messages['analysis.additional_observations']}</strong>
				<rich:separator lineType="solid"/>
				<br/>
				<h:inputTextarea value="#{transactionHelper.transaction.additionalObservations}" rows="5" style="width:75%">
				</h:inputTextarea>
			</div>
			
			<a4j:jsFunction
				name="endAnalysisOK"
				action="#{transactionHelper.endAnalysisOK}"
				oncomplete="if (#{facesContext.maximumSeverity != null}) #{rich:component('msgPanel')}.show();">
			</a4j:jsFunction>
			<a4j:jsFunction
				name="endAnalysisDenied"
				action="#{transactionHelper.endAnalysisDenied}"
				oncomplete="if (#{facesContext.maximumSeverity != null}) #{rich:component('msgPanel')}.show();">
			</a4j:jsFunction>
			<a4j:jsFunction name="pause" action="home" />
		</h:form>
		
		<ui:include src="/zoneselector/selectZonePanel.xhtml">
			<ui:param name="width" value="830" />
			<ui:param name="height" value="630" />
			<ui:param name="drawParcelLayerOnly" value="true" />
			<ui:param name="selectAction" value="transactionHelper.selectZonesFromMap" />
			<ui:param name="render" value="grpZone" />
		</ui:include>
	</ui:define>
	
</ui:composition>
